package org.hiberlyzer.ui;

import org.hiberlyzer.impl.DataSourceFactoryImpl;
import org.hibernate.SessionFactory;
import org.hibernate.cache.HashtableCacheProvider;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;

/**
 * Expects that hibernate mapping and configuration is defined and available through resources on the classpath.
 * @author BDotzour
 *
 */
public class HiberlyzerStandalone
{
	public static void main(String[] args)
	{
		new HiberlyzerStandalone().run();
	}
	
	public void run()
	{
		Configuration configuration = new Configuration().configure();
		configuration.setProperty(Environment.CACHE_PROVIDER, HashtableCacheProvider.class.getName());
		SessionFactory sessionFactory = configuration.buildSessionFactory();
		DataSourceFactoryImpl dataSourceFactory = new DataSourceFactoryImpl(sessionFactory);
		ApplicationWindow application = new ApplicationWindow(dataSourceFactory);
		application.setVisible(true);
	}
}
